<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>智慧图书馆管理系统</title>
    <link href="./all.min.css" rel="stylesheet">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', sans-serif;
        }

        body {
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            position: relative;
        }

        .container {
            background: rgba(255, 255, 255, 0.95);
            padding: 2.5rem;
            border-radius: 20px;
            box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
            width: 90%;
            max-width: 450px;
            transform: translateY(0);
            transition: transform 0.3s ease;
        }

        .container:hover {
            transform: translateY(-5px);
        }

        .header {
            text-align: center;
            margin-bottom: 2rem;
        }

        .header h1 {
            color: #2d3748;
            font-size: 2em;
            margin-bottom: 0.5rem;
        }

        .header p {
            color: #718096;
            font-size: 0.9em;
        }

        .input-group {
            margin-bottom: 1.5rem;
            position: relative;
        }

        .input-group input {
            width: 100%;
            padding: 1rem 1rem 1rem 2.5rem;
            border: 2px solid #e2e8f0;
            border-radius: 8px;
            font-size: 1em;
            transition: all 0.3s ease;
        }

        .input-group input:focus {
            outline: none;
            border-color: #667eea;
            box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
        }

        .input-group i {
            position: absolute;
            left: 1rem;
            top: 50%;
            transform: translateY(-50%);
            color: #a0aec0;
        }

        .remember-me {
            display: flex;
            align-items: center;
            margin-bottom: 1.5rem;
            color: #4a5568;
        }

        .remember-me input {
            margin-right: 0.5rem;
        }

        button {
            width: 100%;
            padding: 1rem;
            background: #667eea;
            color: white;
            border: none;
            border-radius: 8px;
            font-size: 1em;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        button:hover {
            background: #5a67d8;
            transform: translateY(-2px);
        }

        .footer-links {
            margin-top: 1.5rem;
            text-align: center;
        }

        .footer-links a {
            color: #667eea;
            text-decoration: none;
            font-size: 0.9em;
            transition: color 0.3s ease;
        }

        .footer-links a:hover {
            color: #5a67d8;
            text-decoration: underline;
        }

        @media (max-width: 480px) {
            .container {
                padding: 1.5rem;
            }
        }
    </style>
</head>

<body>
    <div class="container">
        <div class="header">
            <h1>📚 智慧图书馆</h1>
            <p>欢迎登录图书管理系统</p>
        </div>

        <form id="myForm">
            <div class="input-group">
                <i class="fas fa-user"></i>
                <input type="text" placeholder="用户名" id="userName" required>
            </div>

            <div class="input-group">
                <i class="fas fa-lock"></i>
                <input type="password" placeholder="密码" id="password" required>
            </div>

            <div class="remember-me">
                <input type="checkbox" id="remember">
                <label for="remember">记住登录状态</label>
            </div>

            <button type="submit">立即登录</button>
        </form>

        <div class="footer-links">
            <a href="#">忘记密码？</a> |
            <a href="#">新用户注册</a>
        </div>
    </div>

    <script src="./jquery-3.7.1.min.js"></script>
    <script>
        // 先阻止表单的默认提交
        $("#myForm").submit(function(e){
            e.preventDefault();

            //ajax请求
            $.ajax({
                type: "post",
                url: "/user/login",
                data: {
                    userName: $("#userName").val(),
                    password: $("#password").val()
                },
                success: function(result){
                    console.log(result);
                    if(result){
                        alert("登录成功！");
                        location.href="index.html";
                    }else{
                        alert("账号或密码错误！");
                    }
                }

            })
        });

    </script>
</body>

</html>